package com.sphd.emanu.utils;

/**
 * @Author Hu
 * @Time 2017/8/5 --12:01.
 * @Email 87683202@qq.com
 */
public enum TypeEnum {
    /**
     status订单状态,0-订单取消,1-订单提交,2-订单接受,3-订单拒绝,4-订单派送,5-订单完成,9-过期订单
     原型上的状态顺序为12450
     原型上的取消按钮变为拒绝,
     修改订单状态时,要变成啥状态就传对应的状态值,比如,要接受,就传2,要取消,就传0
     */
    CANCLE(0, "已取消"), COMMIT(1, "已提交"), ACCEPT(2, "已接收"), REFUSE(3, "已拒绝"), SEND(4, "派送中"), FINISH(5, "已完成");
    private int type;
    private String typeState;

    TypeEnum(int type, String typeState) {
        this.type=type;
        this.typeState=typeState;
    }

    public static String getByValue(int value) {
        for(TypeEnum typeEnum : TypeEnum.values()) {
            if(typeEnum.type == value) {
                return typeEnum.typeState;
            }
        }
        throw new IllegalArgumentException("No element matches " + value);
    }

}
